package com.heima.search.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.UserSearchDto;
import com.heima.search.service.SearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Lijx
 * @Date 2024-07-29 15:52
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/article/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    /**
     * 搜索文章
     * @param searchDto
     * @return
     */
    @PostMapping("/search")
    public ResponseResult searchArticle(@RequestBody UserSearchDto searchDto){
        log.info("搜索文章接口，入参={}",searchDto);
        return searchService.searchArticle(searchDto);
    }

}
